<template>
    <div>
        <div class="image">
            <img class="big" src="../img/01pindan.png" alt="">
            <div class="title">
                团长免单
            </div>
        </div>
        <ul>
            <li v-for="item in oneList1" :key="item.name">
                <router-link :to="'/topic'+item.productId">
                    <img class="imageSmall" :src="item.productsImg" alt="">
                    <div class="right">
                        <h2>{{item.productName}}</h2>
                        <p>
                            <span class="span1">2人团</span>
                            <span class="span2">¥{{item.productPrice}}</span>
                        </p>
                        <div class="button">立即拼团</div>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
import {Collage} from "../../../api"
    export default {
         data(){
            return{
                oneList1:[],
                oneList:[
                  
                ],
                  imgsrc:"http://192.168.10.26:8080/",
            }
        },
        methods:{
            
            Collage(){
                Collage().then(res=>{
                    console.log(res);
                    this.oneList = res.data.data
                this.oneList.map(item=>{
            if(item.discounts == 1){
                 item.productsImg = this.$store.state.imgsrc+item.productsImg

                this.oneList1.push(item)
            }
        })
            console.log(this.oneList1,"www");
                })
            }
        },
         created(){
        this.Collage()
    }
    }
   
</script>

<style scoped>
.image{
    position: relative;
    margin-bottom: 3.5vh;
}
.big{
    width: 100vw;
    height: 20vh;
}
.title{
    width: 80vw;
    height: 6vh;
    margin: 0 auto;
    background: orange;
    font-weight: bold;
    color: white;
    text-align: center;
    font-size: 20px;
    position: absolute;
    bottom: -2vh;
    left: 10vw;
    line-height: 6vh;
    border-bottom-right-radius: 3vh;
    border-bottom-left-radius: 3vh;
}
.imageSmall{
    width: 35vw;
    height: 18vh;
}
li a{
    /* margin-top: 1vh; */
    margin-bottom: 1vh;
    display: flex;
}
h2{
    color: #333333;
    font-size: 16px;
    font-weight: normal;
      display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.right{
    margin-left: 2vw;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
p{
    display: flex;
    align-items: center;
}
.span1{
    color: white;
    padding-left: 15px;
    padding-right: 15px;
    background: #409EFF;
    border-radius: 10px;
    
}
.span2{
    margin-left: 5vw;
    margin-right: 3vw;
    color: #FF380D;
    font-size: 18px;
}
.span3{
    margin-top: 1vh;
    font-size: 12px;
    color: #999999;
    text-decoration: line-through;
}
.button{
    color: white;
    text-align: center;
    border-radius: 5px;
    background: #FF380D;
    width: 55vw;
    height: 5vh;
    line-height: 5vh;
}
</style>